/**
 * Licensed by the Bunie Developmentgroup.
 */
package Protocol;

/**
 * @author Wouter Class to create packets
 */
public abstract class PacketFactory {

    private final static int version = 1;

    /**
     * Methode to return any type of packet
     *
     * @param type Type of packet that needs to be returned
     * @return Requested type of packet or null if value was unknown
     */
    public static BasicPacket getPacket(int type) {
        switch (type) {
            case PacketTypeKeeper.BASICPACKET:
                break;

            case PacketTypeKeeper.INLOGREQUESTPACKET:
                return new InlogRequestPacket(PacketFactory.version);

            case PacketTypeKeeper.INLOGRESPONSEPACKET:
                return new InlogResponsePacket(PacketFactory.version);

            case PacketTypeKeeper.TESTPACKET:
                return new TestPacket(PacketFactory.version);

            case PacketTypeKeeper.QUERYREQUESTPACKET:
                return new QueryRequestPacket(PacketFactory.version);	
				
            case PacketTypeKeeper.QUERYRESPONSEPACKET:
                return new QueryResponsePacket(PacketFactory.version);

            case PacketTypeKeeper.ACCOUNTMANAGEMENTRESPONSEPACKET:
                return new AccountManagementResponsePacket(PacketFactory.version);

            case PacketTypeKeeper.ACCOUNTMANAGEMENTREQUESTPACKET:
                return new AccountManagementRequestPacket(PacketFactory.version);
				
			case PacketTypeKeeper.NEWQUERYALERTPACKET:
				return new NewQueryAlertPacket(PacketFactory.version);

			case PacketTypeKeeper.COLUMNNAMEPACKET:
				return new ColumnNamePacket(PacketFactory.version);
				
            default:
                System.out.println("Unknown packet type");
                break;
        }
        return null;
    }
}